<template>
	<view class="">
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">在线咨询</view>
			</view>
			<image :src="topimg" mode=""></image>
		</view>
		<view class="" style="padding: 30rpx 55rpx;">
			<view class="flexbetween flex_wrap">
				<button open-type="contact" hover-class="none" v-for="item in zyzx_list" :key="item.id">
					<view class="wushi margin_top">
						<image :src="item.image_text" mode=""></image>
					</view>
				</button>
				<!-- <template v-if="userInfo.level==0">
					<button open-type="contact" hover-class="none" v-for="item in zyzx_list" :key="item.id">
						<view class="wushi margin_top">
							<image :src="item.image_text" mode=""></image>
						</view>
					</button>
				</template>
				<template v-if="userInfo.level==1">
					<view class="wushi margin_top" v-for="item in zyzx_list" :key="item.id" @click="zxClick(item)">
						<image :src="item.image_text" mode=""></image>
					</view>
				</template> -->
			</view>
		</view>
		<u-popup :show="popshow" @close="popshow=false">
			<view class="mainpadding">
				<button open-type="contact" hover-class="none">
					<view class="mainpadding flexbetween">
						<view class="titletext">微信客服</view>
						<u-icon name="arrow-right" color="#999" size="20"></u-icon>
					</view>
				</button>
				<view class="mainpadding flexbetween" @click="wodefawu">
					<view class="titletext">我的法务</view>
					<u-icon name="arrow-right" color="#999" size="20"></u-icon>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")

	export default {
		data() {
			return {
				popshow:false,
				topimg: "",
				userInfo: {},
				zyzx_list: [],
				currentitem:{},
			}
		},
		onShow() {
			this.init()
			this.getbanner()
			this.getzyzx() //专业咨询
		},
		methods: {
			wodefawu(){
				this.popshow = false
				uni.navigateTo({
					url:"/pages/wodefw/liuyandan?id="+this.currentitem.id+"&name="+this.currentitem.name
				})
			},
			zxClick(item){
				this.currentitem = item
				this.popshow = true
			},
			getbanner() {
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 23,
					is_more: 2
				}, false, false, true).then(res => {
					this.topimg = res.data.image_text
				})
			},
			getzyzx() { //专业咨询
				httpRequest.request('/api/index/zyzxTypeIndex', 'GET', {}, false, false, true).then(res => {
					this.zyzx_list = res.data
				})
			},
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.wushi {
		width: 302rpx;
		height: 173rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}

	.allicon {
		width: 100%;
		height: 1200rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>